package com.example.springiocdemo.controller;

import com.example.springiocdemo.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("yml")
@RestController
public class Readymlcontroller {
    @Autowired
    private Student student;

    @Value("${myKey}")
    private String key;
    @Value("${myKey.key1}")
    private String key2;

//    @RequestMapping("readyml")
//    public String readYml(){
//        return "从yml中获取配置文件："+port;
//    }
    @RequestMapping("readyml")
    public String readYml(){
        return "从yml中获取配置文件："+key;
    }
    @RequestMapping("readyml1")
    public String readYml1(){
        return "从yml中获取配置文件："+key2;
    }
    @RequestMapping("readStudent")
    public String readStudent(){
        return "从yml中获取配置文件Student："+student;
    }

}
